package com.unit_8;
import java.lang.Object;
import java.util.Objects;

public class Point {
    private double x, y;
    public Point(double x, double y){
        this.x = x;
        this.y = y;
    }
    public double getX(){
        return this.x;
    }
    public double getY(){
        return this.y;
    }
    @Override
    public String toString(){
        return "Point { x = " + this.x + " , y = " + this.y + " }";
    }
    @Override
    public boolean equals(Object obj){
        if(obj instanceof Point)
            return this.x == ((Point)obj).x && this.y == ((Point)obj).y;
        else
            return false;
    }
    @Override
    public int hashCode(){
        return Objects.hash(x, y);
    }

    public static void main(String[] args) {
        Point p1 = new Point(2, 2);
        Point p2 = new Point(2, 3);
        System.out.println(p1.toString());
        System.out.println(p1.equals(p2));
        System.out.println(p1.hashCode());
        System.out.println(p2.hashCode());
    }
}
